/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "preparation")
@NamedQueries({
    @NamedQuery(name = "Preparation.findAll", query = "SELECT p FROM Preparation p"),
    @NamedQuery(name = "Preparation.findByIdpreparation", query = "SELECT p FROM Preparation p WHERE p.idpreparation = :idpreparation"),
    @NamedQuery(name = "Preparation.findByPreparation", query = "SELECT p FROM Preparation p WHERE p.preparation = :preparation")})
public class Preparation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idpreparation")
    private Integer idpreparation;
    @Column(name = "preparation")
    private String preparation;
    @ManyToMany(mappedBy = "preparationList", fetch = FetchType.LAZY)
    private List<Curatorialelement> curatorialelementList;
    @ManyToMany(mappedBy = "preparationList", fetch = FetchType.LAZY)
    private List<Occurrenceelement> occurrenceelementList;

    public Preparation() {
    }

    public Preparation(Integer idpreparation) {
        this.idpreparation = idpreparation;
    }

    public Integer getIdpreparation() {
        return idpreparation;
    }

    public void setIdpreparation(Integer idpreparation) {
        this.idpreparation = idpreparation;
    }

    public String getPreparation() {
        return preparation;
    }

    public void setPreparation(String preparation) {
        this.preparation = preparation;
    }

    public List<Curatorialelement> getCuratorialelementList() {
        return curatorialelementList;
    }

    public void setCuratorialelementList(List<Curatorialelement> curatorialelementList) {
        this.curatorialelementList = curatorialelementList;
    }

    public List<Occurrenceelement> getOccurrenceelementList() {
        return occurrenceelementList;
    }

    public void setOccurrenceelementList(List<Occurrenceelement> occurrenceelementList) {
        this.occurrenceelementList = occurrenceelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpreparation != null ? idpreparation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Preparation)) {
            return false;
        }
        Preparation other = (Preparation) object;
        if ((this.idpreparation == null && other.idpreparation != null) || (this.idpreparation != null && !this.idpreparation.equals(other.idpreparation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Preparation[idpreparation=" + idpreparation + "]";
    }

}
